package cn.edu.hpu.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.edu.hpu.dao.TaskDao;
import cn.edu.hpu.pojo.Group;
import cn.edu.hpu.pojo.Task;
import cn.edu.hpu.util.TimeUtil;
@Service
@Transactional
public class TaskService {
	private TaskDao taskDao;

	public List<Task> findAll(){
		return taskDao.findAll();
	}
	public Task findById(String id){
		return taskDao.get(id);
	}
	public void update(Task task){
		taskDao.update(task);
	}
	public void save(Task task){
		taskDao.save(task);
	}
	public void savetask1(Task task,Group group){
		Task t = new Task();
		t.setCreatetime(TimeUtil.getTime());
		t.setEnd(task.getEnd());
		t.setStart(task.getStart());
		t.setGroup(group);
		t.setTcontent(task.getTcontent());
		t.setTcount(task.getTcount());
		taskDao.save(t);
	}
	public void delete(String id){
		taskDao.del(id);
	}
	
	
	
	
	//setter,getter
	public TaskDao getTaskDao() {
		return taskDao;
	}
	@Autowired
	public void setTaskDao(TaskDao taskDao) {
		this.taskDao = taskDao;
	}
	
}
